Skip to content

fix(continuous-learning): bump observer MAX_TURNS default to 50 (#2035)#2057

Open
fxdv wants to merge 1 commit into
affaan-m:mainfrom
fxdv:fix/observer-max-turns-2035
Open

fix(continuous-learning): bump observer MAX_TURNS default to 50 (#2035)#2057
fxdv wants to merge 1 commit into
affaan-m:mainfrom
fxdv:fix/observer-max-turns-2035

Conversation

@fxdv
Copy link
Copy Markdown

@fxdv fxdv commented May 25, 2026

Summary

Fixes #2035. The observer's MAX_TURNS default of 20 was systematically too small for the MAX_ANALYSIS_LINES default of 500. First-cycle analysis on a fresh project consistently failed with Reached max turns (20), forcing users to either raise ECC_OBSERVER_MAX_TURNS or lower ECC_OBSERVER_MAX_ANALYSIS_LINES before the observer became useful.

This PR pairs the defaults so the out-of-the-box experience succeeds: MAX_TURNS is bumped to 50 — the value the reporter empirically settled on for the 500-line default.

Changes

  • skills/continuous-learning-v2/agents/observer-loop.sh: change three default-site 20s to 50 (lines 208, 213, 218) and add a comment explaining why the defaults must stay paired.
  • tests/hooks/hooks.test.js: update the assertion that pins the default constant so it tracks the new value.

The existing safety floor (turns < 4 falls back to default) is preserved.

Test plan

  • node tests/hooks/hooks.test.js — 237/237 pass (including the updated observer-loop uses a configurable max-turn budget with safe default test)
  • Confirmed both env-var override (ECC_OBSERVER_MAX_TURNS=10 still respected) and non-numeric / sub-4 fallback paths still resolve to the new 50 default
  • No other call sites of ECC_OBSERVER_MAX_TURNS or max_turns=20 exist in the repo (rg confirmed)

Notes for reviewer

I considered an auto-scale approach (e.g. max_turns = ceil(max_lines / 10)) but chose the conservative constant change to minimize blast radius and match the reporter's suggested fix shape. Happy to fold an auto-scale variant in if preferred.


Summary by cubic

Bumps the observer’s default MAX_TURNS from 20 to 50 to match the 500-line analysis default, preventing first-cycle “Reached max turns” failures (addresses #2035). ECC_OBSERVER_MAX_TURNS overrides still work, and the <4 safety fallback stays.

  • Bug Fixes
    • Update skills/continuous-learning-v2/agents/observer-loop.sh to default max_turns to 50 and adjust fallbacks; add a comment linking the default to MAX_ANALYSIS_LINES=500.
    • Update tests/hooks/hooks.test.js to assert the new 50-turn default.

Written for commit 6a2645a. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Chores
    • Increased default observer loop max turns from 20 to 50.
    • Strengthened validation: non-numeric/empty values now default to 50; values below 4 are clamped to 50.
    • Updated tests to match the new default and validation behavior.

Review Change Stack

@fxdv fxdv requested a review from affaan-m as a code owner May 25, 2026 18:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

📝 Walkthrough

Walkthrough

This PR raises the observer analysis default ECC_OBSERVER_MAX_TURNS from 20 to 50, adds coercion for empty/non-numeric values and clamps values below 4 to 50, and updates the test to expect the new default.

Changes

Observer Max-Turns Default Increase

Layer / File(s) Summary
Observer max-turns default increase with validation
skills/continuous-learning-v2/agents/observer-loop.sh, tests/hooks/hooks.test.js
ECC_OBSERVER_MAX_TURNS now defaults to 50 (was 20); empty or non-numeric values are coerced to 50; values below 4 are clamped up to 50. Test assertion updated to expect max_turns="${ECC_OBSERVER_MAX_TURNS:-50}".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 From twenty hops we now take flight,
Fifty turns to better sight.
Bad numbers caught, small ones made strong,
The observer hums its steady song.
🍃 Quiet, careful, code feels right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: bumping the observer MAX_TURNS default from 20 to 50, which is the primary fix in this PR.
Linked Issues check ✅ Passed The PR successfully addresses issue #2035 by implementing the conservative default pairing approach: increasing MAX_TURNS to 50, preserving safety floor validation, and updating corresponding tests.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the issue: updating observer-loop.sh default values and the corresponding test assertion. No unrelated modifications detected.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

…an-m#2035)

The observer's MAX_TURNS default of 20 was systematically insufficient
for the MAX_ANALYSIS_LINES default of 500. First-cycle analysis on a
fresh project consistently failed with "Reached max turns (20)", forcing
users to either raise ECC_OBSERVER_MAX_TURNS or lower
ECC_OBSERVER_MAX_ANALYSIS_LINES before the observer became useful.

Pair the defaults so the out-of-the-box experience succeeds: bump
MAX_TURNS to 50 (the value the reporter empirically settled on for the
500-line default). The safety floor (turns < 4 falls back to default) is
preserved.

Test asserting the default constant is updated alongside the source.
@fxdv fxdv force-pushed the fix/observer-max-turns-2035 branch from 6a2645a to 83b6048 Compare May 25, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Observer default MAX_TURNS=20 insufficient for MAX_ANALYSIS_LINES=500

1 participant